package demo2;

public class Test {

    public static void siwmming(ISwimable iswim) {
        iswim.swim();
    }

    public static void running(IRunable irun) {
        irun.run();
    }

    public static void flying(IFlyable ifly) {
        ifly.fly();
    }

    public static void main(String[] args) {
        Fish fish = new Fish("小金鱼", 120, "白色");
        Duck duck = new Duck("旱鸭子", 119, "黑色");
        Bird bird = new Bird("小飞鸟", 110, "红色");

        //可以自己去调用
//        bird.fly();
//        bird.run();

        //使用参数传递调用
        flying(bird);
        running(bird);
        bird.eat();//也可以直接用实例化对象调用该方法


        fish.swim();
        fish.eat();


        duck.run();
        duck.swim();
        duck.eat();


    }



}
